<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QGraphicsPolygonItem Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QGraphicsPolygonItem Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QGraphicsPolygonItem class provides a polygon item that you
can add to a <a href="qgraphicsscene.html">QGraphicsScene</a>.
<a href="#details">More...</a></p>

<p>Inherits <a href="qabstractgraphicsshapeitem.html">QAbstractGraphicsShapeItem</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qgraphicspolygonitem.html#QGraphicsPolygonItem">__init__</a></b> (<i>self</i>, QGraphicsItem&#160;<i>parent</i>&#160;=&#160;None, QGraphicsScene&#160;<i>scene</i>&#160;=&#160;None)</li><li><div class="fn" /><b><a href="qgraphicspolygonitem.html#QGraphicsPolygonItem-2">__init__</a></b> (<i>self</i>, QPolygonF&#160;<i>polygon</i>, QGraphicsItem&#160;<i>parent</i>&#160;=&#160;None, QGraphicsScene&#160;<i>scene</i>&#160;=&#160;None)</li><li><div class="fn" />QRectF <b><a href="qgraphicspolygonitem.html#boundingRect">boundingRect</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qgraphicspolygonitem.html#contains">contains</a></b> (<i>self</i>, QPointF&#160;<i>point</i>)</li><li><div class="fn" />Qt.FillRule <b><a href="qgraphicspolygonitem.html#fillRule">fillRule</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qgraphicspolygonitem.html#isObscuredBy">isObscuredBy</a></b> (<i>self</i>, QGraphicsItem&#160;<i>item</i>)</li><li><div class="fn" />QPainterPath <b><a href="qgraphicspolygonitem.html#opaqueArea">opaqueArea</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qgraphicspolygonitem.html#paint">paint</a></b> (<i>self</i>, QPainter&#160;<i>painter</i>, QStyleOptionGraphicsItem&#160;<i>option</i>, QWidget&#160;<i>widget</i>&#160;=&#160;None)</li><li><div class="fn" />QPolygonF <b><a href="qgraphicspolygonitem.html#polygon">polygon</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qgraphicspolygonitem.html#setFillRule">setFillRule</a></b> (<i>self</i>, Qt.FillRule&#160;<i>rule</i>)</li><li><div class="fn" /><b><a href="qgraphicspolygonitem.html#setPolygon">setPolygon</a></b> (<i>self</i>, QPolygonF&#160;<i>polygon</i>)</li><li><div class="fn" />QPainterPath <b><a href="qgraphicspolygonitem.html#shape">shape</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qgraphicspolygonitem.html#type">type</a></b> (<i>self</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QGraphicsPolygonItem class provides a polygon item that you
can add to a <a href="qgraphicsscene.html">QGraphicsScene</a>.</p>
<p>To set the item's polygon, pass a <a href="qpolygonf.html">QPolygonF</a> to QGraphicsPolygonItem's
constructor, or call the <a href="qgraphicspolygonitem.html#setPolygon">setPolygon</a>() function.
The <a href="qgraphicspolygonitem.html#polygon">polygon</a>()
function returns the current polygon.</p>
<p class="centerAlign"><img src="images/graphicsview-polygonitem.png" /></p>
<p>QGraphicsPolygonItem uses the polygon and the pen width to
provide a reasonable implementation of <a href="qgraphicspolygonitem.html#boundingRect">boundingRect</a>(),
<a href="qgraphicspolygonitem.html#shape">shape</a>(), and <a href="qgraphicspolygonitem.html#contains">contains</a>(). The <a href="qgraphicspolygonitem.html#paint">paint</a>() function draws the
polygon using the item's associated pen and brush, which you can
set by calling the <a href="qabstractgraphicsshapeitem.html#setPen">setPen</a>() and <a href="qabstractgraphicsshapeitem.html#setBrush">setBrush</a>()
functions.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QGraphicsPolygonItem" />QGraphicsPolygonItem.__init__ (<i>self</i>, <a href="qgraphicsitem.html">QGraphicsItem</a>&#160;<i>parent</i>&#160;=&#160;None, <a href="qgraphicsscene.html">QGraphicsScene</a>&#160;<i>scene</i>&#160;=&#160;None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>The <i>scene</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a <a href="qgraphicspolygonitem.html">QGraphicsPolygonItem</a>. <i>parent</i>
is passed to <a href="qabstractgraphicsshapeitem.html">QAbstractGraphicsShapeItem</a>'s
constructor.</p>
<p><b>See also</b> <a href="qgraphicsscene.html#addItem">QGraphicsScene.addItem</a>().</p>


<h3 class="fn"><a name="QGraphicsPolygonItem-2" />QGraphicsPolygonItem.__init__ (<i>self</i>, <a href="qpolygonf.html">QPolygonF</a>&#160;<i>polygon</i>, <a href="qgraphicsitem.html">QGraphicsItem</a>&#160;<i>parent</i>&#160;=&#160;None, <a href="qgraphicsscene.html">QGraphicsScene</a>&#160;<i>scene</i>&#160;=&#160;None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>The <i>scene</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a <a href="qgraphicspolygonitem.html">QGraphicsPolygonItem</a> with
<i>polygon</i> as the default polygon. <i>parent</i> is passed to
<a href="qabstractgraphicsshapeitem.html">QAbstractGraphicsShapeItem</a>'s
constructor.</p>
<p><b>See also</b> <a href="qgraphicsscene.html#addItem">QGraphicsScene.addItem</a>().</p>


<h3 class="fn"><a name="boundingRect" /><a href="qrectf.html">QRectF</a> QGraphicsPolygonItem.boundingRect (<i>self</i>)</h3><p>Reimplemented from <a href="qgraphicsitem.html#boundingRect">QGraphicsItem.boundingRect</a>().</p>


<h3 class="fn"><a name="contains" />bool QGraphicsPolygonItem.contains (<i>self</i>, <a href="qpointf.html">QPointF</a>&#160;<i>point</i>)</h3><p>Reimplemented from <a href="qgraphicsitem.html#contains">QGraphicsItem.contains</a>().</p>


<h3 class="fn"><a name="fillRule" /><a href="qt.html#FillRule-enum">Qt.FillRule</a> QGraphicsPolygonItem.fillRule (<i>self</i>)</h3><p>Returns the fill rule of the polygon. The default fill rule is
<a href="qt.html#FillRule-enum">Qt.OddEvenFill</a>.</p>
<p><b>See also</b> <a href="qgraphicspolygonitem.html#setFillRule">setFillRule</a>(), <a href="qpainterpath.html#fillRule">QPainterPath.fillRule</a>(), and
<a href="qpainter.html#drawPolygon">QPainter.drawPolygon</a>().</p>


<h3 class="fn"><a name="isObscuredBy" />bool QGraphicsPolygonItem.isObscuredBy (<i>self</i>, <a href="qgraphicsitem.html">QGraphicsItem</a>&#160;<i>item</i>)</h3><p>Reimplemented from <a href="qgraphicsitem.html#isObscuredBy">QGraphicsItem.isObscuredBy</a>().</p>


<h3 class="fn"><a name="opaqueArea" /><a href="qpainterpath.html">QPainterPath</a> QGraphicsPolygonItem.opaqueArea (<i>self</i>)</h3><p>Reimplemented from <a href="qgraphicsitem.html#opaqueArea">QGraphicsItem.opaqueArea</a>().</p>


<h3 class="fn"><a name="paint" />QGraphicsPolygonItem.paint (<i>self</i>, <a href="qpainter.html">QPainter</a>&#160;<i>painter</i>, <a href="qstyleoptiongraphicsitem.html">QStyleOptionGraphicsItem</a>&#160;<i>option</i>, <a href="qwidget.html">QWidget</a>&#160;<i>widget</i>&#160;=&#160;None)</h3><p>Reimplemented from <a href="qgraphicsitem.html#paint">QGraphicsItem.paint</a>().</p>


<h3 class="fn"><a name="polygon" /><a href="qpolygonf.html">QPolygonF</a> QGraphicsPolygonItem.polygon (<i>self</i>)</h3><p>Returns the item's polygon, or an empty polygon if no polygon
has been set.</p>
<p><b>See also</b> <a href="qgraphicspolygonitem.html#setPolygon">setPolygon</a>().</p>


<h3 class="fn"><a name="setFillRule" />QGraphicsPolygonItem.setFillRule (<i>self</i>, <a href="qt.html#FillRule-enum">Qt.FillRule</a>&#160;<i>rule</i>)</h3><p>Sets the fill rule of the polygon to <i>rule</i>. The default
fill rule is <a href="qt.html#FillRule-enum">Qt.OddEvenFill</a>.</p>
<p><b>See also</b> <a href="qgraphicspolygonitem.html#fillRule">fillRule</a>(), <a href="qpainterpath.html#fillRule">QPainterPath.fillRule</a>(), and
<a href="qpainter.html#drawPolygon">QPainter.drawPolygon</a>().</p>


<h3 class="fn"><a name="setPolygon" />QGraphicsPolygonItem.setPolygon (<i>self</i>, <a href="qpolygonf.html">QPolygonF</a>&#160;<i>polygon</i>)</h3><p>Sets the item's polygon to be the given <i>polygon</i>.</p>
<p><b>See also</b> <a href="qgraphicspolygonitem.html#polygon">polygon</a>().</p>


<h3 class="fn"><a name="shape" /><a href="qpainterpath.html">QPainterPath</a> QGraphicsPolygonItem.shape (<i>self</i>)</h3><p>Reimplemented from <a href="qgraphicsitem.html#shape">QGraphicsItem.shape</a>().</p>


<h3 class="fn"><a name="type" />int QGraphicsPolygonItem.type (<i>self</i>)</h3><p>Reimplemented from <a href="qgraphicsitem.html#type">QGraphicsItem.type</a>().</p>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.9.1 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2011</td><td align="right" width="25%">Qt&#160;4.8.0</td></tr></table></div></address></body></html>